Skip to content

Tests: Dump process state when a session-history wait times out - #11021

Closed
sideshowbarker wants to merge 1 commit into
LadybirdBrowser:masterfrom
sideshowbarker:fix-webdriver-no-content-restore-flake
Closed

Tests: Dump process state when a session-history wait times out#11021
sideshowbarker wants to merge 1 commit into
LadybirdBrowser:masterfrom
sideshowbarker:fix-webdriver-no-content-restore-flake

Conversation

@sideshowbarker

@sideshowbarker sideshowbarker commented Aug 6, 2026

Copy link
Copy Markdown
Member

Problem: TestWebDriverSessionHistory intermittently timed out on the Linux x86_64 Release GNU CI job in the cross-process no-content navigation-restore subtest. The harness waits 30s for the restored /a document — which never loads.

Cause: Session-history debug traces from failed runs show the navigation engine doing everything right: the 204 response abandons the provisional cross-site load, the UI receives the cancel, restores previous session history, and begins replacing the provisional WebContent process. The trace then stops mid-replacement. In 3 of 4 failures examined, the last line is the dump written just before the UI spawns the replacement process — a window whose only blocking operations are unbounded sync IPC round-trips to RequestServer, ImageDecoder, and the Compositor — plus the Linux fork helper’s blocking read that waits for the child to exec. In the 4th, the spawn completed — but the fresh WebContent process never processed a single queued IPC message; its first action is itself an unbounded sync IPC call to the UI process. Every one of those waits is silent and has no deadline — so whichever wedges, the failure presents as a clean-looking 30s timeout with no evidence of who was stuck where — the captured logs can’t distinguish the candidates.

Fix: When a wait_for_event wait or a WebDriver HTTP request times out, walk the WebDriver’s process tree via /proc — while the wedged processes are still alive — and print every thread’s name, state, wchan, and current syscall to stderr. Reading /proc doesn’t perturb the processes, works in the CI container, and the next occurrence will show exactly which thread of which process is parked in which blocking call. On macOS (no /proc) and on the passing path, the harness behavior is unchanged.

Problem: TestWebDriverSessionHistory intermittently timed out on the
Linux x86_64 Release GNU CI job in the cross-process no-content
navigation-restore subtest. The harness waits 30s for the restored /a
document — which never loads.

https://github.com/LadybirdBrowser/ladybird/actions/runs/30988508142
https://github.com/LadybirdBrowser/ladybird/actions/runs/30999552155
https://github.com/LadybirdBrowser/ladybird/actions/runs/31042505962
https://github.com/LadybirdBrowser/ladybird/actions/runs/31082213133

Cause: Session-history debug traces from failed runs show the navigation
engine doing everything right: the 204 response abandons the provisional
cross-site load, the UI receives the cancel, restores previous session
history, and begins replacing the provisional WebContent process. The
trace then stops mid-replacement. In 3 of 4 failures examined, the last
line is the dump written just before the UI spawns the replacement
process — a window whose only blocking operations are unbounded sync IPC
round-trips to RequestServer, ImageDecoder, and the Compositor — plus
the Linux fork helper’s blocking read that waits for the child to exec.
In the 4th, the spawn completed — but the fresh WebContent process never
processed a single queued IPC message; its first action is itself an
unbounded sync IPC call to the UI process. Every one of those waits is
silent and has no deadline — so whichever wedges, the failure presents
as a clean-looking 30s timeout with no evidence of who was stuck where —
the captured logs can’t distinguish the candidates.

Fix: When a wait_for_event wait or a WebDriver HTTP request times out,
walk the WebDriver’s process tree via /proc — while the wedged processes
are still alive — and print every thread’s name, state, wchan, and
current syscall to stderr. Reading /proc doesn’t perturb the processes,
works in the CI container, and the next occurrence will show exactly
which thread of which process is parked in which blocking call. On macOS
(no /proc) and on the passing path, the harness behavior is unchanged.
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The test records the WebDriver PID and adds /proc-based process and thread diagnostics. Event and HTTP request timeouts emit best-effort diagnostics before re-raising their existing errors.

Changes

WebDriver timeout forensics

Layer / File(s) Summary
Record the WebDriver process
Tests/LibWebView/test-webdriver-session-history.py
The test stores the spawned WebDriver subprocess PID in a global variable.
Collect and emit timeout diagnostics
Tests/LibWebView/test-webdriver-session-history.py
The test inspects descendant processes and threads through /proc. Event and HTTP request timeouts print diagnostics before propagating the timeout.
Estimated code review effort: 3 (Moderate) ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Test as test-webdriver-session-history.py
  participant WebDriver as WebDriver subprocess
  participant Proc as /proc filesystem
  Test->>WebDriver: spawn and record PID
  Test->>WebDriver: wait for event or HTTP response
  WebDriver-->>Test: timeout
  Test->>Proc: inspect descendant processes and threads
  Proc-->>Test: return forensic details
  Test-->>Test: print diagnostics and re-raise timeout
Loading

Possibly related PRs

Suggested reviewers: awesomekling, shannonbooth

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The description clearly explains the intermittent timeout problem and the added process-tree diagnostics, which directly match the changeset.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sideshowbarker

Copy link
Copy Markdown
Member Author

Closing. #11028 is the fix for the cited CI failures. And while I’d imagined this’d be able to dump out info that’d lead to a solution for those CI failures (or similar ones that might come along later), in the end it proved to be useless for those. So it’s a solution for a problem that it turns out we never actually had to begin with.

@sideshowbarker
sideshowbarker deleted the fix-webdriver-no-content-restore-flake branch August 7, 2026 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant